<html>
<head><meta charset="utf-8"><title>coherence bypasses for traits #57893 · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html">coherence bypasses for traits #57893</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="175591173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175591173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175591173">(Sep 13 2019 at 03:42)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  created this topic for discussion on  <a href="https://github.com/rust-lang/rust/issues/57893" target="_blank" title="https://github.com/rust-lang/rust/issues/57893">https://github.com/rust-lang/rust/issues/57893</a></p>



<a name="175656571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175656571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175656571">(Sep 13 2019 at 19:27)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="128294">@blitzerr</span> -- sounds good. I wanted to point you to this branch on my repository:</p>



<a name="175656635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175656635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175656635">(Sep 13 2019 at 19:28)</a>:</h4>
<p><a href="https://github.com/nikomatsakis/rust/tree/degenerate-object-safe-issue-57893" target="_blank" title="https://github.com/nikomatsakis/rust/tree/degenerate-object-safe-issue-57893">https://github.com/nikomatsakis/rust/tree/degenerate-object-safe-issue-57893</a></p>



<a name="175656677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175656677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175656677">(Sep 13 2019 at 19:28)</a>:</h4>
<p>I went up taking a <em>slightly</em> different path than what I described in those mentoring instructions, in that I rearranged the ordering. I think the code is mostly prepared now for the so-called "degenerate" cases, but the function that looks for them needs to be written still.</p>



<a name="175657153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175657153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175657153">(Sep 13 2019 at 19:34)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> nice points re. <code>dyn trait A</code> as sugar for <code>trait A</code> + <code>where dyn A: A</code> &amp; re. <code>dyn trait Iterator { ... }</code></p>



<a name="175657181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175657181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175657181">(Sep 13 2019 at 19:35)</a>:</h4>
<p>this fits nicely together with 2027</p>



<a name="175657314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175657314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175657314">(Sep 13 2019 at 19:37)</a>:</h4>
<p>(the other zulip thread is <a href="#narrow/stream/131828-t-compiler/topic/.2357893.20coherence.20and.20traits/near/169073560" title="#narrow/stream/131828-t-compiler/topic/.2357893.20coherence.20and.20traits/near/169073560">https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.2357893.20coherence.20and.20traits/near/169073560</a> which has other examples due to <span class="user-mention" data-user-id="228094">@Ariel Ben-Yehuda</span>)</p>



<a name="175659318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175659318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175659318">(Sep 13 2019 at 20:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  thanks for the link. Will look into it.</p>



<a name="175659447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175659447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariel Ben-Yehuda <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175659447">(Sep 13 2019 at 20:04)</a>:</h4>
<p>This approach looks right to me</p>



<a name="175659502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/175659502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ariel Ben-Yehuda <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#175659502">(Sep 13 2019 at 20:05)</a>:</h4>
<p>And I don't think we need to change anything but selection - projection won't use an object candidate if selection doesn't return one.</p>



<a name="176332567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176332567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176332567">(Sep 23 2019 at 00:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  I don't how can I check if user has already implemented a variant that can be used for <code>Trait Object</code> ?</p>



<a name="176332936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176332936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176332936">(Sep 23 2019 at 00:59)</a>:</h4>
<p>How do I write the logic solver for <code>impl_potentially_overlapping_dyn_trait</code> ? Is there an example I can look at ?</p>



<a name="176337623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176337623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176337623">(Sep 23 2019 at 03:34)</a>:</h4>
<p><span class="user-mention" data-user-id="228094">@Ariel Ben-Yehuda</span>  ^</p>



<a name="176405396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405396">(Sep 23 2019 at 20:17)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span></p>



<a name="176405456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405456">(Sep 23 2019 at 20:18)</a>:</h4>
<p>What I had in mind was to start with a fairly dumb check</p>



<a name="176405482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405482">(Sep 23 2019 at 20:18)</a>:</h4>
<p>hi <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="176405564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405564">(Sep 23 2019 at 20:19)</a>:</h4>
<p>In particular, I wrote the following in the issue</p>
<blockquote>
<p>So clearly the (semi-)syntactic check I was <em>first</em> envisioning is too simplistic. What we want is to see whether there is some impl of <code>SomeTrait</code> whose self type <em>could</em> be <code>dyn SomeTrait</code> (or equivalent to it). This can happen in basically three ways:</p>
<p>- a type parameter that is <code>?Sized</code><br>
- an associated type projection (with any parameters) that is <code>?Sized</code><br>
- a <code>dyn SomeTrait</code> type (which we already check for)<br>
- an opaque type, but those are disallowed and the semantics are unclear anyway<br>
- a type alias that equates to one of those things</p>
</blockquote>



<a name="176405588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405588">(Sep 23 2019 at 20:19)</a>:</h4>
<p>So, the idea would be this. We will iterate over the impls of the trait</p>



<a name="176405591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405591">(Sep 23 2019 at 20:19)</a>:</h4>
<p>and we will look at the "self-type" of each impl</p>



<a name="176405609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405609">(Sep 23 2019 at 20:19)</a>:</h4>
<p>we can basically do <code>match self_ty.sty { ... }</code></p>



<a name="176405626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405626">(Sep 23 2019 at 20:20)</a>:</h4>
<p>and then try to look for those cases I listed</p>



<a name="176405703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405703">(Sep 23 2019 at 20:20)</a>:</h4>
<blockquote>
<p>So, the idea would be this. We will iterate over the impls of the trait</p>
</blockquote>
<p>so let's start with this</p>



<a name="176405714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405714">(Sep 23 2019 at 20:20)</a>:</h4>
<p>we have this function</p>



<a name="176405722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405722">(Sep 23 2019 at 20:20)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">impl_potentially_overlapping_dyn_trait</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">trait_def_id</span>: <span class="nc">DefId</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">bool</span>
</pre></div>



<a name="176405732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405732">(Sep 23 2019 at 20:21)</a>:</h4>
<p>Sounds good.</p>



<a name="176405750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405750">(Sep 23 2019 at 20:21)</a>:</h4>
<p>we can get the <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/trait_def/struct.TraitDef.html" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/trait_def/struct.TraitDef.html"><code>TraitDef</code></a> for the given id by invoking <code>tcx.trait_def(trait_def_id)</code></p>



<a name="176405791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405791">(Sep 23 2019 at 20:21)</a>:</h4>
<p>this has a method already calls <code>for_each_impl</code></p>



<a name="176405856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405856">(Sep 23 2019 at 20:22)</a>:</h4>
<p>this is .. probably not what we <em>really</em> want to use, because it's kind of inefficient, but it's ok to start</p>



<a name="176405892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405892">(Sep 23 2019 at 20:22)</a>:</h4>
<p>so you can do <code>trait_def.for_each_impl(|impl_def_id| { ... })</code></p>



<a name="176405966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176405966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176405966">(Sep 23 2019 at 20:23)</a>:</h4>
<blockquote>
<p>this is .. probably not what we <em>really</em> want to use, because it's kind of inefficient, but it's ok to start</p>
</blockquote>
<p>it's inefficient because it literally iterates over <em>all</em> impls. But most of them are clearly not relevant -- e.g., an impl like <code>impl Foo for u32</code> doesn't apply. We have the impls sorted by their "approximate self-type" precisely to make this sort of check faster. But, as I said, we can worry about that a bit later.</p>



<a name="176406117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406117">(Sep 23 2019 at 20:24)</a>:</h4>
<p>Once you have the <code>impl</code>, you can get its precise self type by using the <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TyCtxt.html#method.type_of" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TyCtxt.html#method.type_of"><code>type_of(impl_def_id)</code></a> query</p>



<a name="176406126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406126">(Sep 23 2019 at 20:24)</a>:</h4>
<p>then we can try matching that</p>



<a name="176406130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406130">(Sep 23 2019 at 20:24)</a>:</h4>
<p>so now we have something like</p>



<a name="176406284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406284">(Sep 23 2019 at 20:26)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">found_match</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span><span class="p">;</span><span class="w"></span>
<span class="n">tcx</span><span class="p">.</span><span class="n">trait_def</span><span class="p">(</span><span class="n">trait_def_id</span><span class="p">).</span><span class="n">for_each_impl</span><span class="p">(</span><span class="o">|</span><span class="n">impl_def_id</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">impl_self_ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tcx</span><span class="p">.</span><span class="n">type_of</span><span class="p">(</span><span class="n">impl_def_id</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">impl_self_ty</span><span class="p">.</span><span class="n">sty</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">ty</span>::<span class="n">Param</span><span class="p">(</span><span class="n">param_ty</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">...,</span><span class="w"> </span><span class="c1">// one line for each of the cases above</span>
<span class="w">        </span><span class="p">...,</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">});</span><span class="w"></span>
</pre></div>



<a name="176406306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406306">(Sep 23 2019 at 20:27)</a>:</h4>
<p>rustdoc for <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/sty/enum.TyKind.html#variant.Param" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/sty/enum.TyKind.html#variant.Param"><code>ty::Param</code></a></p>



<a name="176406333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406333">(Sep 23 2019 at 20:27)</a>:</h4>
<p>so that match above will match any type parameter, but we want only <code>?Sized</code> type parameters</p>



<a name="176406356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406356">(Sep 23 2019 at 20:28)</a>:</h4>
<p>that's a <em>bit</em> annoying, I have to look, but one way to find that out would to ask for <code>tcx.predicates_of(impl_def_id)</code>, which will give you where clauses from the impl</p>



<a name="176406406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406406">(Sep 23 2019 at 20:28)</a>:</h4>
<p>you could look for one that matches <code>impl_self_ty: Sized</code></p>



<a name="176406418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406418">(Sep 23 2019 at 20:28)</a>:</h4>
<p>there might be another place where we record the relevant info tho</p>



<a name="176406424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406424">(Sep 23 2019 at 20:28)</a>:</h4>
<p>or some similar code</p>



<a name="176406432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406432">(Sep 23 2019 at 20:28)</a>:</h4>
<p>anyway, I'd say just start with <em>that one case</em></p>



<a name="176406460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406460">(Sep 23 2019 at 20:28)</a>:</h4>
<p>we can come back to these:</p>
<p>- an associated type projection (with any parameters) that is <code>?Sized</code><br>
- a <code>dyn SomeTrait</code> type (which we already check for)<br>
- an opaque type, but those are disallowed and the semantics are unclear anyway</p>



<a name="176406478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406478">(Sep 23 2019 at 20:29)</a>:</h4>
<p>really, only the second one needs work anyway</p>



<a name="176406483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406483">(Sep 23 2019 at 20:29)</a>:</h4>
<p>with me so far?</p>



<a name="176406498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406498">(Sep 23 2019 at 20:29)</a>:</h4>
<p>ok wait</p>



<a name="176406510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406510">(Sep 23 2019 at 20:29)</a>:</h4>
<blockquote>
<p>you could look for one that matches <code>impl_self_ty: Sized</code></p>
</blockquote>
<p>there is some code for this already in <code>traits/object_safety.rs</code> that could be refactored to suit our puposes</p>



<a name="176406606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406606">(Sep 23 2019 at 20:30)</a>:</h4>
<p>in particular <a href="https://github.com/rust-lang/rust/blob/66bf391c3aabfc77f5f7139fc9e6944f995d574e/src/librustc/traits/object_safety.rs#L254-L256" target="_blank" title="https://github.com/rust-lang/rust/blob/66bf391c3aabfc77f5f7139fc9e6944f995d574e/src/librustc/traits/object_safety.rs#L254-L256">this function, <code>trait_has_sized_self</code></a> checks whether the <em>trait</em> declares a predicate <code>where Self: Sized</code></p>



<a name="176406647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406647">(Sep 23 2019 at 20:31)</a>:</h4>
<p>and in particular <a href="https://github.com/rust-lang/rust/blob/66bf391c3aabfc77f5f7139fc9e6944f995d574e/src/librustc/traits/object_safety.rs#L271" target="_blank" title="https://github.com/rust-lang/rust/blob/66bf391c3aabfc77f5f7139fc9e6944f995d574e/src/librustc/traits/object_safety.rs#L271">this line</a> is the one that is checking for <code>Self</code> -- note that <code>Self</code> is a type parameter of the trait</p>



<a name="176406662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406662">(Sep 23 2019 at 20:31)</a>:</h4>
<p>Rookie question - why is Sized the only one in which case a conflict can occur ?</p>



<a name="176406672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406672">(Sep 23 2019 at 20:31)</a>:</h4>
<p>Can't it be any associative type ?</p>



<a name="176406689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406689">(Sep 23 2019 at 20:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="176406692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406692">(Sep 23 2019 at 20:31)</a>:</h4>
<p>we are looking for impls that could apply where the self type is <code>dyn Foo</code> -- that is an unsized type (that is, <code>dyn Foo: Sized</code> is false)</p>



<a name="176406750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406750">(Sep 23 2019 at 20:32)</a>:</h4>
<p>this isn't the most precise check, but it's an easy one</p>



<a name="176406760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406760">(Sep 23 2019 at 20:32)</a>:</h4>
<p>that is, if we know that <code>T: Sized</code>, then we rule out the possibility that <code>T == dyn Foo</code></p>



<a name="176406767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406767">(Sep 23 2019 at 20:32)</a>:</h4>
<p>(there could be other ways to rule that out, too)</p>



<a name="176406776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406776">(Sep 23 2019 at 20:32)</a>:</h4>
<p>it's "sufficient but not necessary", I guess</p>



<a name="176406859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406859">(Sep 23 2019 at 20:33)</a>:</h4>
<p>Thank you so much for your time and explaining this to me <span class="user-mention" data-user-id="116009">@nikomatsakis</span>  <span aria-label="pray" class="emoji emoji-1f64f" role="img" title="pray">:pray:</span></p>



<a name="176406930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176406930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176406930">(Sep 23 2019 at 20:34)</a>:</h4>
<p>I will give it a shot (tonight, hopefully)</p>



<a name="176407162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407162">(Sep 23 2019 at 20:37)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> great! let me know how it goes of course.</p>



<a name="176407194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407194">(Sep 23 2019 at 20:37)</a>:</h4>
<blockquote>
<p>in particular <a href="https://github.com/rust-lang/rust/blob/66bf391c3aabfc77f5f7139fc9e6944f995d574e/src/librustc/traits/object_safety.rs#L254-L256" target="_blank" title="https://github.com/rust-lang/rust/blob/66bf391c3aabfc77f5f7139fc9e6944f995d574e/src/librustc/traits/object_safety.rs#L254-L256">this function, <code>trait_has_sized_self</code></a> checks whether the <em>trait</em> declares a predicate <code>where Self: Sized</code></p>
</blockquote>
<p>I think what we want to do here, to finish the thought, is refactor this to something like <code>generics_require_param_sized(self, def_id: DefId, param_ty: ParamTy) -&gt; bool { ... }</code></p>



<a name="176407225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407225">(Sep 23 2019 at 20:37)</a>:</h4>
<p>Absolutely <span class="user-mention" data-user-id="116009">@nikomatsakis</span>  <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="176407276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407276">(Sep 23 2019 at 20:38)</a>:</h4>
<p>and then in place of <code>is_param(0)</code> we'd invoke <code>is_param(param_ty.index)</code></p>



<a name="176407289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407289">(Sep 23 2019 at 20:38)</a>:</h4>
<p>the existing callers can use <code>ParamTy::for_self()</code></p>



<a name="176407296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407296">(Sep 23 2019 at 20:38)</a>:</h4>
<p>to create a <code>ParamTy</code></p>



<a name="176407308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407308">(Sep 23 2019 at 20:38)</a>:</h4>
<p>your <em>new</em> caller would be using the <code>param_ty</code> it extracted via the <code>match</code></p>



<a name="176407363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407363">(Sep 23 2019 at 20:39)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">found_match</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span><span class="p">;</span><span class="w"></span>
<span class="n">tcx</span><span class="p">.</span><span class="n">trait_def</span><span class="p">(</span><span class="n">trait_def_id</span><span class="p">).</span><span class="n">for_each_impl</span><span class="p">(</span><span class="o">|</span><span class="n">impl_def_id</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">impl_self_ty</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tcx</span><span class="p">.</span><span class="n">type_of</span><span class="p">(</span><span class="n">impl_def_id</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">impl_self_ty</span><span class="p">.</span><span class="n">sty</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">ty</span>::<span class="n">Param</span><span class="p">(</span><span class="n">param_ty</span><span class="p">)</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">generics_require_param_sized</span><span class="p">(</span><span class="n">impl_def_id</span><span class="p">,</span><span class="w"> </span><span class="n">param_ty</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">found_match</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">});</span><span class="w"></span>
<span class="n">found_match</span><span class="w"></span>
</pre></div>


<p>so something like that <span aria-label="point up" class="emoji emoji-1f446" role="img" title="point up">:point_up:</span></p>



<a name="176407368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407368">(Sep 23 2019 at 20:39)</a>:</h4>
<p>Some of this will only make sense to me after I spend some time looking at the code. <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="176407374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407374">(Sep 23 2019 at 20:39)</a>:</h4>
<p>yep. I'm done typing now, let me know how it goes :)</p>



<a name="176407401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407401">(Sep 23 2019 at 20:39)</a>:</h4>
<p>Sure <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="176407504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176407504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176407504">(Sep 23 2019 at 20:40)</a>:</h4>
<p>Typing is good. I can always revisit to connect the pieces that way.  <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="176857766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176857766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176857766">(Sep 29 2019 at 05:52)</a>:</h4>
<p>I made the first set of <a href="https://github.com/blitzerr/rust/commit/e932c748fda9ef152573f544219a1996b7f71d00" target="_blank" title="https://github.com/blitzerr/rust/commit/e932c748fda9ef152573f544219a1996b7f71d00">changes</a> <span class="user-mention" data-user-id="116009">@nikomatsakis</span> .</p>



<a name="176857818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176857818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176857818">(Sep 29 2019 at 05:54)</a>:</h4>
<p>I am testing this against</p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">Object</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="o">?</span><span class="nb">Sized</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Object</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">U</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="n">T</span>: <span class="o">?</span><span class="nb">Sized</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="o">&lt;</span><span class="n">T</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">Object</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;&gt;</span>::<span class="n">Output</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">U</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">transmute</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">U</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span>::<span class="o">&lt;</span><span class="n">dyn</span><span class="w"> </span><span class="n">Object</span><span class="o">&lt;</span><span class="n">U</span><span class="p">,</span><span class="w"> </span><span class="n">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="176857827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176857827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176857827">(Sep 29 2019 at 05:55)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="o">[</span>DEBUG rustc::traits::object_safety<span class="o">]</span> trait_pred.def_id<span class="o">()</span> <span class="o">==</span> sized_def_id: <span class="k">false</span> <span class="p">;;</span> trait_pred.skip_binder<span class="o">()</span>.self_ty<span class="o">()</span>.is_param<span class="o">(</span>param_ty.index<span class="o">)</span>: <span class="k">true</span>
<span class="o">[</span>DEBUG rustc::traits::object_safety<span class="o">]</span> trait_pred.def_id<span class="o">()</span> <span class="o">==</span> sized_def_id: <span class="k">true</span> <span class="p">;;</span> trait_pred.skip_binder<span class="o">()</span>.self_ty<span class="o">()</span>.is_param<span class="o">(</span>param_ty.index<span class="o">)</span>: <span class="k">false</span>
<span class="o">[</span>DEBUG rustc::traits::object_safety<span class="o">]</span> trait_pred.def_id<span class="o">()</span> <span class="o">==</span> sized_def_id: <span class="k">true</span> <span class="p">;;</span> trait_pred.skip_binder<span class="o">()</span>.self_ty<span class="o">()</span>.is_param<span class="o">(</span>param_ty.index<span class="o">)</span>: <span class="k">false</span>
<span class="o">[</span>DEBUG rustc::traits::object_safety<span class="o">]</span> trait_pred.def_id<span class="o">()</span> <span class="o">==</span> sized_def_id: <span class="k">false</span> <span class="p">;;</span> trait_pred.skip_binder<span class="o">()</span>.self_ty<span class="o">()</span>.is_param<span class="o">(</span>param_ty.index<span class="o">)</span>: <span class="k">true</span>
<span class="o">[</span>DEBUG rustc::traits::object_safety<span class="o">]</span> trait_pred.def_id<span class="o">()</span> <span class="o">==</span> sized_def_id: <span class="k">true</span> <span class="p">;;</span> trait_pred.skip_binder<span class="o">()</span>.self_ty<span class="o">()</span>.is_param<span class="o">(</span>param_ty.index<span class="o">)</span>: <span class="k">false</span>
<span class="o">[</span>DEBUG rustc::traits::object_safety<span class="o">]</span> trait_pred.def_id<span class="o">()</span> <span class="o">==</span> sized_def_id: <span class="k">true</span> <span class="p">;;</span> trait_pred.skip_binder<span class="o">()</span>.self_ty<span class="o">()</span>.is_param<span class="o">(</span>param_ty.index<span class="o">)</span>: <span class="k">false</span>
<span class="o">[</span>DEBUG rustc::traits::object_safety<span class="o">]</span> Match <span class="nv">found</span> <span class="o">=</span> <span class="k">false</span><span class="p">;</span> <span class="k">for</span> param_ty T
<span class="o">[</span>DEBUG rustc::traits::object_safety<span class="o">]</span> trait_pred.def_id<span class="o">()</span> <span class="o">==</span> sized_def_id: <span class="k">false</span> <span class="p">;;</span> trait_pred.skip_binder<span class="o">()</span>.self_ty<span class="o">()</span>.is_param<span class="o">(</span>param_ty.index<span class="o">)</span>: <span class="k">true</span>
</pre></div>



<a name="176857874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176857874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176857874">(Sep 29 2019 at 05:56)</a>:</h4>
<p>For  </p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span>: <span class="o">?</span><span class="nb">Sized</span><span class="p">,</span><span class="w"> </span><span class="n">U</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Object</span><span class="o">&lt;</span><span class="n">U</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">T</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">U</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>(from above), the type parameter is <code>?Sized</code>, so we should have got <code>true</code> in the log line <br>
<code>[DEBUG rustc::traits::object_safety] Match found = false; for param_ty T</code><br>
right ?</p>



<a name="176935358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176935358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176935358">(Sep 30 2019 at 14:09)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> yep, I would think so, I'll try to look more closely in a bit</p>



<a name="176954239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176954239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176954239">(Sep 30 2019 at 17:33)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> Sorry, my fault. The match occurs if <code>self.generics_require_sized_param</code> returns <strong>false</strong> -- that is, we are looking for an impl like <code>impl&lt;T: ?Sized&gt; Foo for T</code></p>



<a name="176954405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176954405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176954405">(Sep 30 2019 at 17:35)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  <code>?</code> means may or maynot, is it ?</p>



<a name="176954477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176954477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176954477">(Sep 30 2019 at 17:36)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> right -- by default, if you have <code>impl&lt;T&gt;</code>, we add an implicit <code>T: Sized</code>. The <code>T: ?Sized</code> notation suppresses that default</p>



<a name="176954479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176954479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176954479">(Sep 30 2019 at 17:36)</a>:</h4>
<p>Okay, that would make sense</p>



<a name="176954772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176954772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176954772">(Sep 30 2019 at 17:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I was wondering, if there is a way to see the generated code, like the additional <code>impl</code> that would be added by the compiler (that we are trying to solve) ?</p>



<a name="176956447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176956447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176956447">(Sep 30 2019 at 17:56)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> no, that impl is sort of "hard-coded" into the trait solver</p>



<a name="176960319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176960319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176960319">(Sep 30 2019 at 18:35)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  I see. Is it true for the implicit <code>T: Sized</code>  also ?</p>



<a name="176960389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176960389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176960389">(Sep 30 2019 at 18:36)</a>:</h4>
<p>(That no way to see it somehow).</p>



<a name="176963612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176963612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176963612">(Sep 30 2019 at 19:10)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> no, the <code>T: Sized</code> does show up in the result of <code>predicates</code> and so forth, but I don't know an easy way to dump that out</p>



<a name="176966988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176966988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176966988">(Sep 30 2019 at 19:48)</a>:</h4>
<p>I see. Thanks <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="176967046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176967046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176967046">(Sep 30 2019 at 19:48)</a>:</h4>
<p>What should be the next steps here? Should we do the optimizations ?</p>



<a name="176967317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176967317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176967317">(Sep 30 2019 at 19:51)</a>:</h4>
<p>And the tests <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="176968275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176968275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176968275">(Sep 30 2019 at 20:01)</a>:</h4>
<p>Well <span class="user-mention" data-user-id="128294">@blitzerr</span> do you have it working now?</p>



<a name="176968289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176968289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176968289">(Sep 30 2019 at 20:01)</a>:</h4>
<p>I think the next step is to try and see what breaks first, and if we've fixed the bug</p>



<a name="176968938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176968938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176968938">(Sep 30 2019 at 20:07)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> what branch are you working off on in your repo?</p>



<a name="176969019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176969019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176969019">(Sep 30 2019 at 20:08)</a>:</h4>
<p>ah I guess <a href="https://github.com/blitzerr/rust/tree/degenerate-object-safety-57893" target="_blank" title="https://github.com/blitzerr/rust/tree/degenerate-object-safety-57893">https://github.com/blitzerr/rust/tree/degenerate-object-safety-57893</a></p>



<a name="176969061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176969061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176969061">(Sep 30 2019 at 20:08)</a>:</h4>
<p>well, I'd say to try that code (once you fix the bug) and see whether the <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=f99bbe03831128591e1111e625b7b2f3" target="_blank" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=f99bbe03831128591e1111e625b7b2f3">weaponized transmute</a> example gives an error or not</p>



<a name="176969281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176969281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176969281">(Sep 30 2019 at 20:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  <code>degenerate-object-safety-57893</code> branch</p>



<a name="176970379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176970379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176970379">(Sep 30 2019 at 20:21)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w"> </span><span class="n">build</span><span class="o">/</span><span class="n">x86_64</span><span class="o">-</span><span class="n">apple</span><span class="o">-</span><span class="n">darwin</span><span class="o">/</span><span class="n">stage1</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">rustc</span><span class="w"> </span><span class="n">weaponized_transmute</span><span class="p">.</span><span class="n">rs</span><span class="w">                                    </span><span class="mi">341</span><span class="n">ms</span><span class="w"> </span><span class="err"></span><span class="w"> </span><span class="n">Mon</span><span class="w"> </span><span class="n">Sep</span><span class="w"> </span><span class="mi">30</span><span class="w"> </span><span class="mi">13</span>:<span class="mi">20</span>:<span class="mi">55</span><span class="w"> </span><span class="mi">2019</span><span class="w"></span>
<span class="n">error</span><span class="p">[</span><span class="n">E0391</span><span class="p">]</span>: <span class="nc">cycle</span><span class="w"> </span><span class="n">detected</span><span class="w"> </span><span class="n">when</span><span class="w"> </span><span class="n">determine</span><span class="w"> </span><span class="n">object</span><span class="w"> </span><span class="n">safety</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="err">`</span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="err">`</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="o">/</span><span class="n">Users</span><span class="o">/</span><span class="n">blitz</span><span class="o">/</span><span class="n">rustc</span><span class="o">-</span><span class="n">dev</span><span class="o">/</span><span class="n">rust</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">libcore</span><span class="o">/</span><span class="n">ops</span><span class="o">/</span><span class="n">deref</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">64</span>:<span class="mi">1</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="mi">64</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Deref</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"> </span><span class="o">^^^^^^^^^^^^^^^</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="p">...</span><span class="n">which</span><span class="w"> </span><span class="n">requires</span><span class="w"> </span><span class="n">normalizing</span><span class="w"> </span><span class="err">`</span><span class="n">ParamEnvAnd</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">param_env</span>: <span class="nc">ParamEnv</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">caller_bounds</span>: <span class="p">[</span><span class="n">Binder</span><span class="p">(</span><span class="n">TraitPredicate</span><span class="p">(</span><span class="o">&lt;</span><span class="n">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&gt;</span><span class="p">))],</span><span class="w"> </span><span class="n">reveal</span>: <span class="nc">All</span><span class="p">,</span><span class="w"> </span><span class="n">def_id</span>: <span class="nb">None</span> <span class="p">},</span><span class="w"> </span><span class="n">value</span>: <span class="kp">&amp;</span><span class="nc">dyn</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&lt;</span><span class="n">Target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&gt;</span>::<span class="n">Target</span><span class="o">&gt;</span><span class="w"> </span><span class="p">}</span><span class="err">`</span><span class="p">...</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="p">...</span><span class="n">which</span><span class="w"> </span><span class="n">requires</span><span class="w"> </span><span class="n">normalizing</span><span class="w"> </span><span class="err">`</span><span class="n">Canonical</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">max_universe</span>: <span class="nc">U0</span><span class="p">,</span><span class="w"> </span><span class="n">variables</span>: <span class="p">[],</span><span class="w"> </span><span class="n">value</span>: <span class="nc">ParamEnvAnd</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">param_env</span>: <span class="nc">ParamEnv</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">caller_bounds</span>: <span class="p">[</span><span class="n">Binder</span><span class="p">(</span><span class="n">TraitPredicate</span><span class="p">(</span><span class="o">&lt;</span><span class="n">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&gt;</span><span class="p">))],</span><span class="w"> </span><span class="n">reveal</span>: <span class="nc">All</span><span class="p">,</span><span class="w"> </span><span class="n">def_id</span>: <span class="nb">None</span> <span class="p">},</span><span class="w"> </span><span class="n">value</span>: <span class="nc">ProjectionTy</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">substs</span>: <span class="p">[</span><span class="n">Self</span><span class="p">],</span><span class="w"> </span><span class="n">item_def_id</span>: <span class="nc">DefId</span><span class="p">(</span><span class="mi">2</span>:<span class="mi">1704</span><span class="w"> </span><span class="o">~</span><span class="w"> </span><span class="n">core</span><span class="p">[</span><span class="n">d402</span><span class="p">]</span>::<span class="n">ops</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>::<span class="n">deref</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>::<span class="n">Deref</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>::<span class="n">Target</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="err">`</span><span class="p">...</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="p">...</span><span class="n">which</span><span class="w"> </span><span class="n">again</span><span class="w"> </span><span class="n">requires</span><span class="w"> </span><span class="n">determine</span><span class="w"> </span><span class="n">object</span><span class="w"> </span><span class="n">safety</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="err">`</span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="err">`</span><span class="p">,</span><span class="w"> </span><span class="n">completing</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">cycle</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="nc">cycle</span><span class="w"> </span><span class="n">used</span><span class="w"> </span><span class="n">when</span><span class="w"> </span><span class="n">evaluating</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">selection</span><span class="w"> </span><span class="n">obligation</span><span class="w"> </span><span class="err">`</span><span class="o">&lt;</span><span class="n">T</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&gt;</span>::<span class="n">Target</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">U</span><span class="err">`</span><span class="w"></span>

<span class="n">error</span>: <span class="nc">aborting</span><span class="w"> </span><span class="n">due</span><span class="w"> </span><span class="n">to</span><span class="w"> </span><span class="n">previous</span><span class="w"> </span><span class="n">error</span><span class="w"></span>

<span class="n">For</span><span class="w"> </span><span class="n">more</span><span class="w"> </span><span class="n">information</span><span class="w"> </span><span class="n">about</span><span class="w"> </span><span class="n">this</span><span class="w"> </span><span class="n">error</span><span class="p">,</span><span class="w"> </span><span class="n">try</span><span class="w"> </span><span class="err">`</span><span class="n">rustc</span><span class="w"> </span><span class="o">--</span><span class="n">explain</span><span class="w"> </span><span class="n">E0391</span><span class="err">`</span><span class="p">.</span><span class="w"></span>
</pre></div>



<a name="176970774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176970774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176970774">(Sep 30 2019 at 20:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  I am getting this error currently <span aria-label="point of information" class="emoji emoji-261d" role="img" title="point of information">:point_of_information:</span></p>



<a name="176970906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176970906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176970906">(Sep 30 2019 at 20:27)</a>:</h4>
<p>sigh</p>



<a name="176971385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176971385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176971385">(Sep 30 2019 at 20:32)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> did rustc bootstrap though?</p>



<a name="176971442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176971442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176971442">(Sep 30 2019 at 20:33)</a>:</h4>
<p>hmm</p>



<a name="176971448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176971448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176971448">(Sep 30 2019 at 20:33)</a>:</h4>
<p>I don't think we need the full normalization here</p>



<a name="176971714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176971714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176971714">(Sep 30 2019 at 20:36)</a>:</h4>
<p>ok <span class="user-mention" data-user-id="128294">@blitzerr</span> hmm maybe I was wrong to suggest re-using the same helper.</p>



<a name="176971977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176971977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176971977">(Sep 30 2019 at 20:39)</a>:</h4>
<p>in particular that helper is used from two distinct places</p>



<a name="176971983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176971983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176971983">(Sep 30 2019 at 20:39)</a>:</h4>
<p>actually 3</p>



<a name="176972101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972101">(Sep 30 2019 at 20:40)</a>:</h4>
<p>one of them requires us to be conservative  -- ie., we <em>need</em> to detect <code>where Self: Sized</code> because it's an error if it is present</p>



<a name="176972145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972145">(Sep 30 2019 at 20:40)</a>:</h4>
<p>but in the other two cases, it's more than the presernce of <code>where Self: Sized</code> <em>avoids</em> errors that would otherwise occur, so it'd be ok to miss one</p>



<a name="176972194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972194">(Sep 30 2019 at 20:41)</a>:</h4>
<p>the reason we're getting a cycle error comes from having to normalize associated types</p>



<a name="176972241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972241">(Sep 30 2019 at 20:41)</a>:</h4>
<p>i.e., converting something like <code>&lt;Foo as Iterator&gt;::Item</code> into its equivalent type (if we can figure out a better one)</p>



<a name="176972256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972256">(Sep 30 2019 at 20:41)</a>:</h4>
<p>but that isn't really needed for the check I had in mind</p>



<a name="176972309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972309">(Sep 30 2019 at 20:42)</a>:</h4>
<p>that normalization is done as part of the <code>elaborate_predicates</code> step</p>



<a name="176972403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972403">(Sep 30 2019 at 20:43)</a>:</h4>
<p>I think what you want to do -- at least for now -- is to create a clone of that helper function <code>generics_require_sized_self</code> which does not do the <code>elaborate_predicates</code> call</p>



<a name="176972438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972438">(Sep 30 2019 at 20:43)</a>:</h4>
<p>so something ike</p>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="k">fn</span> <span class="nf">generics_require_sized_self</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">def_id</span>: <span class="nc">DefId</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">bool</span> <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">sized_def_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">lang_items</span><span class="p">().</span><span class="n">sized_trait</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="nb">Some</span><span class="p">(</span><span class="n">def_id</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">def_id</span><span class="p">,</span><span class="w"></span>
<span class="w">            </span><span class="nb">None</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="kc">false</span><span class="p">;</span><span class="w"> </span><span class="cm">/* No Sized trait, can&#39;t require it! */</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>

<span class="w">        </span><span class="c1">// Search for a predicate like `Self : Sized` amongst the trait bounds.</span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">predicates</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">predicates_of</span><span class="p">(</span><span class="n">def_id</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">predicates</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">predicates</span><span class="p">.</span><span class="n">instantiate_identity</span><span class="p">(</span><span class="bp">self</span><span class="p">).</span><span class="n">predicates</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="n">predicates</span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"> </span><span class="c1">// not elaborate_predicates(self, predicates)</span>
<span class="w">            </span><span class="p">.</span><span class="n">any</span><span class="p">(</span><span class="o">|</span><span class="n">predicate</span><span class="o">|</span><span class="w">  </span><span class="cm">/* as before */</span><span class="w">      </span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="176972523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972523">(Sep 30 2019 at 20:44)</a>:</h4>
<p>this could miss some cases, e.g. if the user wrote something like <code>impl&lt;T: ?Sized + Foo&gt;</code> and you had <code>trait Foo: Sized</code></p>



<a name="176972534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972534">(Sep 30 2019 at 20:44)</a>:</h4>
<p>but that's ok because that will make us <em>more</em> conservative in this case</p>



<a name="176972571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176972571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176972571">(Sep 30 2019 at 20:44)</a>:</h4>
<p>we're really interested in that <em>syntactic</em> check of "did they disable the default or not"</p>



<a name="176973810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176973810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176973810">(Sep 30 2019 at 20:57)</a>:</h4>
<blockquote>
<p>but in the other two cases, it's more than the presernce of <code>where Self: Sized</code> <em>avoids</em> errors that would otherwise occur, so it'd be ok to miss one</p>
</blockquote>
<p>Can you elaborate on this one ? *It's more than the presence *</p>



<a name="176973988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176973988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176973988">(Sep 30 2019 at 20:58)</a>:</h4>
<blockquote>
<p>the reason we're getting a cycle error comes from having to normalize associated types</p>
<p>i.e., converting something like <code>&lt;Foo as Iterator&gt;::Item</code> into its equivalent type (if we can figure out a better one)</p>
</blockquote>
<p>So because we are introducing associative types that are cyclical in the <code>weaponized-transmute</code> ?</p>



<a name="176974088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176974088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176974088">(Sep 30 2019 at 20:59)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  <span aria-label="point of information" class="emoji emoji-261d" role="img" title="point of information">:point_of_information:</span></p>



<a name="176974160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176974160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176974160">(Sep 30 2019 at 21:00)</a>:</h4>
<p>By the way, is <code>weaponized-transmute</code> a standard term in the <code>PL</code> literature ?</p>



<a name="176974254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176974254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176974254">(Sep 30 2019 at 21:01)</a>:</h4>
<p>not at all</p>



<a name="176974287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176974287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176974287">(Sep 30 2019 at 21:01)</a>:</h4>
<blockquote>
<p>Can you elaborate on this one ? *It's more than the presence *</p>
</blockquote>
<p>it should have been "it's more <em>that</em> the presence of <code>where Self: Sized</code> avoids errors"</p>



<a name="176974451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176974451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176974451">(Sep 30 2019 at 21:03)</a>:</h4>
<p>i.e., if there is a <code>where Self: Sized</code>, then there is no error; so if we have a check that looks for <code>where Self: Sized</code>, but sometimes it misses some, that might cause extra errors -- but it won't cause us to accept code we should not have accepted</p>



<a name="176974481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176974481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176974481">(Sep 30 2019 at 21:03)</a>:</h4>
<blockquote>
<p>By the way, is <code>weaponized-transmute</code> a standard term in the <code>PL</code> literature ?</p>
</blockquote>
<p>we sometimes say "weaponized" to mean "we showed how you could use this bug to violate memory safety"</p>



<a name="176974628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/176974628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#176974628">(Sep 30 2019 at 21:05)</a>:</h4>
<blockquote>
<p>So because we are introducing associative types that are cyclical in the <code>weaponized-transmute</code> ?</p>
</blockquote>
<p>the new check we are adding to the <code>object_safety.rs</code> code is now causing us to do normalizations we weren't doing before; but doing those normalizations requires us to check object safety (that itself is perhaps also fixable, now that I think about it... but in any case I'd still like to push forward on the simpler version of this branch mostly so that we can tell if this approach is even viable)</p>



<a name="177006700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177006700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177006700">(Oct 01 2019 at 03:02)</a>:</h4>
<blockquote>
<blockquote>
<p>Can you elaborate on this one ? *It's more than the presence *</p>
</blockquote>
<p>it should have been "it's more <em>that</em> the presence of <code>where Self: Sized</code> avoids errors"</p>
</blockquote>
<p>Got it. Now it makes sense. <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="177018393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177018393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177018393">(Oct 01 2019 at 03:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  The state of the world does not change by much <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>
<div class="codehilite"><pre><span></span><span class="n">error</span><span class="p">[</span><span class="n">E0391</span><span class="p">]</span>: <span class="nc">cycle</span><span class="w"> </span><span class="n">detected</span><span class="w"> </span><span class="n">when</span><span class="w"> </span><span class="n">determine</span><span class="w"> </span><span class="n">object</span><span class="w"> </span><span class="n">safety</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="err">`</span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="err">`</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="o">/</span><span class="n">Users</span><span class="o">/</span><span class="n">blitz</span><span class="o">/</span><span class="n">rustc</span><span class="o">-</span><span class="n">dev</span><span class="o">/</span><span class="n">rust</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">libcore</span><span class="o">/</span><span class="n">ops</span><span class="o">/</span><span class="n">deref</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">64</span>:<span class="mi">1</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="mi">64</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Deref</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"> </span><span class="o">^^^^^^^^^^^^^^^</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="p">...</span><span class="n">which</span><span class="w"> </span><span class="n">requires</span><span class="w"> </span><span class="n">normalizing</span><span class="w"> </span><span class="err">`</span><span class="n">ParamEnvAnd</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">param_env</span>: <span class="nc">ParamEnv</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">caller_bounds</span>: <span class="p">[</span><span class="n">Binder</span><span class="p">(</span><span class="n">TraitPredicate</span><span class="p">(</span><span class="o">&lt;</span><span class="n">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&gt;</span><span class="p">))],</span><span class="w"> </span><span class="n">reveal</span>: <span class="nc">All</span><span class="p">,</span><span class="w"> </span><span class="n">def_id</span>: <span class="nb">None</span> <span class="p">},</span><span class="w"> </span><span class="n">value</span>: <span class="kp">&amp;</span><span class="nc">dyn</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&lt;</span><span class="n">Target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&gt;</span>::<span class="n">Target</span><span class="o">&gt;</span><span class="w"> </span><span class="p">}</span><span class="err">`</span><span class="p">...</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="p">...</span><span class="n">which</span><span class="w"> </span><span class="n">requires</span><span class="w"> </span><span class="n">normalizing</span><span class="w"> </span><span class="err">`</span><span class="n">Canonical</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">max_universe</span>: <span class="nc">U0</span><span class="p">,</span><span class="w"> </span><span class="n">variables</span>: <span class="p">[],</span><span class="w"> </span><span class="n">value</span>: <span class="nc">ParamEnvAnd</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">param_env</span>: <span class="nc">ParamEnv</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">caller_bounds</span>: <span class="p">[</span><span class="n">Binder</span><span class="p">(</span><span class="n">TraitPredicate</span><span class="p">(</span><span class="o">&lt;</span><span class="n">Self</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&gt;</span><span class="p">))],</span><span class="w"> </span><span class="n">reveal</span>: <span class="nc">All</span><span class="p">,</span><span class="w"> </span><span class="n">def_id</span>: <span class="nb">None</span> <span class="p">},</span><span class="w"> </span><span class="n">value</span>: <span class="nc">ProjectionTy</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">substs</span>: <span class="p">[</span><span class="n">Self</span><span class="p">],</span><span class="w"> </span><span class="n">item_def_id</span>: <span class="nc">DefId</span><span class="p">(</span><span class="mi">2</span>:<span class="mi">1704</span><span class="w"> </span><span class="o">~</span><span class="w"> </span><span class="n">core</span><span class="p">[</span><span class="n">d402</span><span class="p">]</span>::<span class="n">ops</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>::<span class="n">deref</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>::<span class="n">Deref</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>::<span class="n">Target</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="err">`</span><span class="p">...</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="p">...</span><span class="n">which</span><span class="w"> </span><span class="n">again</span><span class="w"> </span><span class="n">requires</span><span class="w"> </span><span class="n">determine</span><span class="w"> </span><span class="n">object</span><span class="w"> </span><span class="n">safety</span><span class="w"> </span><span class="n">of</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="err">`</span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="err">`</span><span class="p">,</span><span class="w"> </span><span class="n">completing</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">cycle</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="nc">cycle</span><span class="w"> </span><span class="n">used</span><span class="w"> </span><span class="n">when</span><span class="w"> </span><span class="n">evaluating</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">selection</span><span class="w"> </span><span class="n">obligation</span><span class="w"> </span><span class="err">`</span><span class="o">&lt;</span><span class="n">T</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="n">Deref</span><span class="o">&gt;</span>::<span class="n">Target</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">U</span><span class="err">`</span><span class="w"></span>

<span class="n">error</span>: <span class="nc">aborting</span><span class="w"> </span><span class="n">due</span><span class="w"> </span><span class="n">to</span><span class="w"> </span><span class="n">previous</span><span class="w"> </span><span class="n">error</span><span class="w"></span>

<span class="n">For</span><span class="w"> </span><span class="n">more</span><span class="w"> </span><span class="n">information</span><span class="w"> </span><span class="n">about</span><span class="w"> </span><span class="n">this</span><span class="w"> </span><span class="n">error</span><span class="p">,</span><span class="w"> </span><span class="n">try</span><span class="w"> </span><span class="err">`</span><span class="n">rustc</span><span class="w"> </span><span class="o">--</span><span class="n">explain</span><span class="w"> </span><span class="n">E0391</span><span class="err">`</span><span class="p">.</span><span class="w"></span>
</pre></div>



<a name="177018522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177018522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177018522">(Oct 01 2019 at 03:51)</a>:</h4>
<p>Maybe we need to get rid of <code>let predicates = predicates.instantiate_identity(self).predicates;</code> ?</p>



<a name="177020337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177020337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177020337">(Oct 01 2019 at 04:06)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="kd">let</span><span class="w"> </span><span class="n">predicates</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="bp">self</span><span class="p">.</span><span class="n">predicates_of</span><span class="p">(</span><span class="n">def_id</span><span class="p">).</span><span class="n">predicates</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="c1">// let predicates = predicates.instantiate_identity(self).predicates;</span>
<span class="w">        </span><span class="n">predicates</span><span class="w"></span>
<span class="w">            </span><span class="p">.</span><span class="n">iter</span><span class="p">()</span><span class="w"></span>
</pre></div>



<a name="177020702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177020702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177020702">(Oct 01 2019 at 04:08)</a>:</h4>
<p>I went a step futher, and removed the call to the <code>instantiate_identity</code> and yet we still get the same error</p>
<div class="codehilite"><pre><span></span>error[E0391]: cycle detected when determine object safety of trait `std::ops::Deref`
  --&gt; /Users/blitz/rustc-dev/rust/src/libcore/ops/deref.rs:64:1
   |
64 | pub trait Deref {
   | ^^^^^^^^^^^^^^^
   |
   = note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(&lt;Self as std::ops::Deref&gt;))], reveal: All, def_id: None }, value: &amp;dyn std::ops::Deref&lt;Target = &lt;Self as std::ops::Deref&gt;::Target&gt; }`...
   = note: ...which requires normalizing `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(&lt;Self as std::ops::Deref&gt;))], reveal: All, def_id: None }, value: ProjectionTy { substs: [Self], item_def_id: DefId(2:1704 ~ core[d402]::ops[0]::deref[0]::Deref[0]::Target[0]) } } }`...
   = note: ...which again requires determine object safety of trait `std::ops::Deref`, completing the cycle
   = note: cycle used when evaluating trait selection obligation `&lt;T as std::ops::Deref&gt;::Target == U`
</pre></div>



<a name="177020990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177020990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177020990">(Oct 01 2019 at 04:09)</a>:</h4>
<p>My branch has the latest changes. I will look again tomorrow.</p>



<a name="177072627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177072627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177072627">(Oct 01 2019 at 16:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Maybe there is no straight forward way to avoid the cycle and we have to keep track of elements so that we don't ?</p>



<a name="177093182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177093182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177093182">(Oct 01 2019 at 20:12)</a>:</h4>
<p>I'll have to check out your branch <span class="user-mention" data-user-id="128294">@blitzerr</span></p>



<a name="177100857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177100857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177100857">(Oct 01 2019 at 21:46)</a>:</h4>
<p>ok, I think maybe I am starting to see the problem actually</p>



<a name="177100873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177100873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177100873">(Oct 01 2019 at 21:47)</a>:</h4>
<p>well, not quite yet :)</p>



<a name="177100896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177100896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177100896">(Oct 01 2019 at 21:47)</a>:</h4>
<p>(I am reproducing it, though)</p>



<a name="177243047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243047">(Oct 03 2019 at 13:21)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> ok I understand the problem now</p>



<a name="177243061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243061">(Oct 03 2019 at 13:21)</a>:</h4>
<p>it's not really related to the code you wrote, it's actually related to the code <strong>I</strong> wrote</p>



<a name="177243074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243074">(Oct 03 2019 at 13:21)</a>:</h4>
<p>I think we want to separate the "object safety" test from the "degeneracy" test</p>



<a name="177243153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243153">(Oct 03 2019 at 13:22)</a>:</h4>
<p><span aria-label="clap" class="emoji emoji-1f44f" role="img" title="clap">:clap:</span> awesome</p>



<a name="177243168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243168">(Oct 03 2019 at 13:22)</a>:</h4>
<p>right now we have this code</p>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="p">(</span><span class="k">super</span><span class="p">)</span><span class="w"> </span><span class="k">fn</span> <span class="nf">object_safety_provider</span><span class="p">(</span><span class="n">tcx</span>: <span class="nc">TyCtxt</span><span class="o">&lt;</span><span class="na">&#39;_</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">trait_def_id</span>: <span class="nc">DefId</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">ObjectSafety</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="o">!</span><span class="n">tcx</span><span class="p">.</span><span class="n">object_safety_violations</span><span class="p">(</span><span class="n">trait_def_id</span><span class="p">).</span><span class="n">is_empty</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">return</span><span class="w"> </span><span class="n">ObjectSafety</span>::<span class="n">Not</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="n">tcx</span><span class="p">.</span><span class="n">impl_potentially_overlapping_dyn_trait</span><span class="p">(</span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">trait_def_id</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">return</span><span class="w"> </span><span class="n">ObjectSafety</span>::<span class="n">Degenerate</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="n">ObjectSafety</span>::<span class="n">Full</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="177243190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243190">(Oct 03 2019 at 13:23)</a>:</h4>
<p>the thing that's causing the <em>cycles</em> though is this addition I made to the <a href="http://select.rs" target="_blank" title="http://select.rs">select.rs</a> code:</p>



<a name="177243205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243205">(Oct 03 2019 at 13:23)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">        </span><span class="c1">// First check if the trait is object-safe -- if not fully object safe,</span>
<span class="w">        </span><span class="c1">// then we would never supply an impl in the first case.</span>
<span class="w">        </span><span class="k">match</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">tcx</span><span class="p">().</span><span class="n">object_safety</span><span class="p">(</span><span class="n">obligation</span><span class="p">.</span><span class="n">predicate</span><span class="p">.</span><span class="n">def_id</span><span class="p">())</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">ObjectSafety</span>::<span class="n">Full</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="n">ObjectSafety</span>::<span class="n">Degenerate</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">ObjectSafety</span>::<span class="n">Not</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="k">return</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="177243229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243229">(Oct 03 2019 at 13:23)</a>:</h4>
<p>you'll see that if you remove the call to <code>impl_potentially_overlapping_dyn_trait</code> altogether you still get a cycle</p>



<a name="177243322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243322">(Oct 03 2019 at 13:24)</a>:</h4>
<p>I think what we want to do is add a <em>separate</em> query -- something like <code>dyn_implements_self</code> or <code>degenerate_object_safety</code> -- that just do the <code>impl_potentially_overlapping_dyn_trait</code> check for a given trait</p>



<a name="177243329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243329">(Oct 03 2019 at 13:24)</a>:</h4>
<p>and <em>that</em> is what we check in the <code>select.rs</code> code</p>



<a name="177243348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243348">(Oct 03 2019 at 13:25)</a>:</h4>
<p>I'm not sure yet what I think this means in the bigger picture, but it's a step in the right direction</p>



<a name="177243735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243735">(Oct 03 2019 at 13:28)</a>:</h4>
<p>So <code>objecy_safety</code> just checks <code>Full</code>or <code>Not</code> and we have another query for the <code>Degenerate</code> ?</p>



<a name="177243770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243770">(Oct 03 2019 at 13:29)</a>:</h4>
<p>Who calls the degenerate check ?</p>



<a name="177243784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243784">(Oct 03 2019 at 13:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="177243804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243804">(Oct 03 2019 at 13:29)</a>:</h4>
<blockquote>
<p>So <code>objecy_safety</code> just checks <code>Full</code>or <code>Not</code> and we have another query for the <code>Degenerate</code> ?</p>
</blockquote>
<p>yeah I think my early commits are kind of wrong-ish now</p>



<a name="177243852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243852">(Oct 03 2019 at 13:30)</a>:</h4>
<p>I refactored to introduce that enum I thnk</p>



<a name="177243866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243866">(Oct 03 2019 at 13:30)</a>:</h4>
<p>but if we're splitting up the check it's probably not what we want</p>



<a name="177243893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243893">(Oct 03 2019 at 13:30)</a>:</h4>
<blockquote>
<p>Who calls the degenerate check ?</p>
</blockquote>
<p>the <a href="http://select.rs" target="_blank" title="http://select.rs">select.rs</a> quote I added, which I copied above</p>



<a name="177243928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243928">(Oct 03 2019 at 13:30)</a>:</h4>
<p>there might however be another way to handle this</p>



<a name="177243930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177243930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177243930">(Oct 03 2019 at 13:30)</a>:</h4>
<p>I'm debating :)</p>



<a name="177245115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177245115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177245115">(Oct 03 2019 at 13:43)</a>:</h4>
<p>well, we can try more than one thing</p>



<a name="177757704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177757704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177757704">(Oct 09 2019 at 21:25)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> I ugess I kind of left you hanging here, huh?</p>



<a name="177757878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177757878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177757878">(Oct 09 2019 at 21:28)</a>:</h4>
<p>I am still looking at this. To be very honest, this weekend I hardly had any time.</p>



<a name="177757909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/177757909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#177757909">(Oct 09 2019 at 21:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="178857545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178857545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178857545">(Oct 23 2019 at 14:15)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="128294">@blitzerr</span> so I did some investigation here and I'm happy to report some progress</p>



<a name="178857626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178857626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178857626">(Oct 23 2019 at 14:16)</a>:</h4>
<p>though I seem to be having an issue pushing to your branch for some reason</p>



<a name="178857627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178857627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178857627">(Oct 23 2019 at 14:16)</a>:</h4>
<p>oh, I guess permission denied</p>



<a name="178857645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178857645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178857645">(Oct 23 2019 at 14:16)</a>:</h4>
<p>well, on my fork, the branch <code> nikomatsakis/degenerate-object-safe-issue-57893 </code> contains a fix for the cycle query</p>



<a name="178857648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178857648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178857648">(Oct 23 2019 at 14:16)</a>:</h4>
<p>I also fixed another minor bug</p>



<a name="178857655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178857655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178857655">(Oct 23 2019 at 14:16)</a>:</h4>
<p>the good news is that the unsoundness seems to be corrected,and that we are also able to bootstrap</p>



<a name="178857656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178857656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178857656">(Oct 23 2019 at 14:16)</a>:</h4>
<p>I've not yet dared to run test suite, will start that now</p>



<a name="178858377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178858377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178858377">(Oct 23 2019 at 14:25)</a>:</h4>
<p>lol</p>



<a name="178858380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178858380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178858380">(Oct 23 2019 at 14:25)</a>:</h4>
<p>I thnk i broke something</p>



<a name="178858383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178858383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178858383">(Oct 23 2019 at 14:25)</a>:</h4>
<div class="codehilite"><pre><span></span>running 9016 tests
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 100/9016
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF. 200/9016
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 300/9016
FFFFFF...FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF..FFFF.FFFF 400/9016
FFFFFFFF.FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFiFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 500/9016
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 600/9016
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 700/9016
</pre></div>



<a name="178862239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178862239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178862239">(Oct 23 2019 at 15:00)</a>:</h4>
<p>Not sure why you are getting permission denied. <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="178862314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178862314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178862314">(Oct 23 2019 at 15:01)</a>:</h4>
<p>That looks like a lot to fix <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="178862574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178862574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178862574">(Oct 23 2019 at 15:03)</a>:</h4>
<p>(I don't think that's related to the PR, I think something went wrong in the build)</p>



<a name="178862639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178862639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178862639">(Oct 23 2019 at 15:04)</a>:</h4>
<p>hmm, although a make clean yields the same problem</p>



<a name="178862643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178862643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178862643">(Oct 23 2019 at 15:04)</a>:</h4>
<p>the errors are weird though</p>



<a name="178862650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178862650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178862650">(Oct 23 2019 at 15:04)</a>:</h4>
<p><em>oh</em> I bet I know what it's related to</p>



<a name="178862750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/178862750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#178862750">(Oct 23 2019 at 15:05)</a>:</h4>
<p>I think the problem is that the query is not defined on traits from other crates</p>



<a name="179129559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/179129559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#179129559">(Oct 26 2019 at 15:10)</a>:</h4>
<p>I missed this message. I am sorry</p>



<a name="179129635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/179129635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#179129635">(Oct 26 2019 at 15:12)</a>:</h4>
<p>Looking at your updates on the GitHub issue <span class="user-mention" data-user-id="116009">@nikomatsakis</span> , it looks like you have figured out bigger atuufs that might need to change here. Should we carve out some time to scope and then solve each of the issues you are talking about ?</p>



<a name="179381683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/179381683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#179381683">(Oct 29 2019 at 22:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  ^</p>



<a name="180548803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180548803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180548803">(Nov 12 2019 at 18:58)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="180548989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180548989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180548989">(Nov 12 2019 at 19:00)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="128294">@blitzerr</span> --</p>



<a name="180548999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180548999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180548999">(Nov 12 2019 at 19:00)</a>:</h4>
<p>so indeed there has been some progress here</p>



<a name="180549007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180549007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180549007">(Nov 12 2019 at 19:00)</a>:</h4>
<p>I've written up a few comments,</p>



<a name="180549043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180549043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180549043">(Nov 12 2019 at 19:00)</a>:</h4>
<p>and I have a PR that is meant to measure the impact of my proposed change</p>



<a name="180549044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180549044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180549044">(Nov 12 2019 at 19:00)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/66037" target="_blank" title="https://github.com/rust-lang/rust/pull/66037">https://github.com/rust-lang/rust/pull/66037</a></p>



<a name="180549081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180549081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180549081">(Nov 12 2019 at 19:01)</a>:</h4>
<p>Probably what is most needed now is to <a href="https://github.com/rust-lang/rust/pull/66037#issuecomment-551989851" target="_blank" title="https://github.com/rust-lang/rust/pull/66037#issuecomment-551989851">dig more into the regressions that were found</a> and try to figure out their causes</p>



<a name="180549092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180549092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180549092">(Nov 12 2019 at 19:01)</a>:</h4>
<p>But I'm not sure how much you've followd the latest thinking</p>



<a name="180550040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180550040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180550040">(Nov 12 2019 at 19:10)</a>:</h4>
<p>I missed the follow ups. I will take a look at the pull and then ask questions if something I don't understand. <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="180550052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180550052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180550052">(Nov 12 2019 at 19:10)</a>:</h4>
<p>OK, well,</p>



<a name="180550093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180550093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180550093">(Nov 12 2019 at 19:11)</a>:</h4>
<p>the comments on the issue (<a href="https://github.com/rust-lang/rust/issues/57893#issuecomment-546489739" target="_blank" title="https://github.com/rust-lang/rust/issues/57893#issuecomment-546489739">starting around here</a>) might be a good place to start, <span class="user-mention" data-user-id="128294">@blitzerr</span></p>



<a name="180554049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180554049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180554049">(Nov 12 2019 at 19:49)</a>:</h4>
<p>Thanks a lot <span class="user-mention" data-user-id="116009">@nikomatsakis</span> will go through them tonight</p>



<a name="180760194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180760194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180760194">(Nov 14 2019 at 18:41)</a>:</h4>
<p><span class="user-mention" data-user-id="118594">@ecstatic-morse</span> thanks for extracting the failed crates Dylan :)</p>



<a name="180760213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180760213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180760213">(Nov 14 2019 at 18:41)</a>:</h4>
<p>did you use your jq script ?</p>



<a name="180760373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180760373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180760373">(Nov 14 2019 at 18:43)</a>:</h4>
<p>(I was unsure whether we’d need the crate versions in the list) I’ll look at maybe integrating this in crater as well so we can easily re-run experiments on previous regression results</p>



<a name="180760501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180760501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180760501">(Nov 14 2019 at 18:45)</a>:</h4>
<p>Yep. For now it lives in a <a href="https://gist.github.com/ecstatic-morse/be799bfa4d3b3d6e163fa61a9c30706f" target="_blank" title="https://gist.github.com/ecstatic-morse/be799bfa4d3b3d6e163fa61a9c30706f">gist</a>. It would be very nice to have this integrated. In the meantime just ping me if you want this; it takes like 30 seconds.</p>



<a name="180760836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180760836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180760836">(Nov 14 2019 at 18:49)</a>:</h4>
<p>thanks :)</p>



<a name="180760918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180760918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180760918">(Nov 14 2019 at 18:49)</a>:</h4>
<p>was that supposed to be a link to the script ? (I can only see the list of failed crates on mobile here)</p>



<a name="180761063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180761063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180761063">(Nov 14 2019 at 18:50)</a>:</h4>
<p>Whoops. <a href="https://gist.github.com/ecstatic-morse/be799bfa4d3b3d6e163fa61a9c30706f" target="_blank" title="https://gist.github.com/ecstatic-morse/be799bfa4d3b3d6e163fa61a9c30706f">Here it is</a></p>



<a name="180981602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/180981602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#180981602">(Nov 18 2019 at 01:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  based on your proposal <a href="https://github.com/rust-lang/rust/issues/57893#issuecomment-546972824" target="_blank" title="https://github.com/rust-lang/rust/issues/57893#issuecomment-546972824">here</a>, looks like we are changing course a little bit ?</p>



<a name="181042783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181042783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181042783">(Nov 18 2019 at 18:36)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> yeah we have to</p>



<a name="181044218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181044218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181044218">(Nov 18 2019 at 18:51)</a>:</h4>
<p>Okay. So what would be the next steps for me <span class="user-mention" data-user-id="116009">@nikomatsakis</span>  ?</p>



<a name="181605269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181605269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181605269">(Nov 22 2019 at 02:30)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> <a href="https://github.com/rust-lang/rust/issues/57893#issuecomment-557356550" target="_blank" title="https://github.com/rust-lang/rust/issues/57893#issuecomment-557356550">I left some notes here</a> -- I think the immediate next step is to go find the impls that are causing the errors from all affected crates. I started doing this in <a href="https://hackmd.io/s0jcU0VsSsaAkc-9ZipRHg" target="_blank" title="https://hackmd.io/s0jcU0VsSsaAkc-9ZipRHg">this hackmd</a>, maybe that gives you an idea what i'm looking for. Just logging the relevant impl (plus, perhaps, a link to its source, but that's not necessary) for the trait that's causing the error would be awesome. I can come and look at them later to see if I can extract useful patterns.</p>



<a name="181607491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181607491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181607491">(Nov 22 2019 at 03:36)</a>:</h4>
<p>Thanks <span class="user-mention" data-user-id="116009">@nikomatsakis</span> will do. I am traveling and will be back after Thanksgiving, so the progress may not be much</p>



<a name="181648886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181648886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181648886">(Nov 22 2019 at 15:38)</a>:</h4>
<p>quick question to clarify: to help with this, we'd only want to note the impls which triggered an  <code>impl_potentially_overlapping_dyn_trait</code> warning, and not the <code>cannot be made into an object</code> errors that happened without the warning ? (and that's why the 3 <code>biscuit::serde_custom::flatten::ToJson</code> cases were marked as "not a true root regression" because there's only a trait object error without the overlapping impl ?)</p>



<a name="181673851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181673851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181673851">(Nov 22 2019 at 20:22)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> I may have been mistaken</p>



<a name="181673855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181673855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181673855">(Nov 22 2019 at 20:22)</a>:</h4>
<p>but I thought that <code>serde_custom</code> was another crate</p>



<a name="181673874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181673874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181673874">(Nov 22 2019 at 20:23)</a>:</h4>
<p>for some reason I don't fully understand</p>



<a name="181673878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181673878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181673878">(Nov 22 2019 at 20:23)</a>:</h4>
<p>you don't always get warnings</p>



<a name="181673949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181673949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181673949">(Nov 22 2019 at 20:24)</a>:</h4>
<p>e.g. I'm not sure why the <a href="https://crater-reports.s3.amazonaws.com/pr-66037-1/try%23c593fd608dcac7408e7fed4b8c115e906033f80e/reg/euphrates_cli-0.1.0/log.txt" target="_blank" title="https://crater-reports.s3.amazonaws.com/pr-66037-1/try%23c593fd608dcac7408e7fed4b8c115e906033f80e/reg/euphrates_cli-0.1.0/log.txt">euphrades logs</a> don't give a warning, since I think those traits are defined within the crate</p>



<a name="181675279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181675279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181675279">(Nov 22 2019 at 20:45)</a>:</h4>
<p>that's indeed a bit confusing, if the warnings are not always present</p>



<a name="181675548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181675548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181675548">(Nov 22 2019 at 20:49)</a>:</h4>
<p>(<code>serde_custom</code> is indeed a module of <code>biscuit</code>) so I guess just looking for the warning will not be enough; good to know, I was expecting this PR would have <code>deny</code>-ed the lint/warning</p>



<a name="181689580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181689580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181689580">(Nov 23 2019 at 00:08)</a>:</h4>
<p>(ah it seems like we mostly get the <code>warning: impl_potentially_overlapping_dyn_trait</code> when building a crate's own code, not always when it's in a dependency)</p>



<a name="181695286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181695286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181695286">(Nov 23 2019 at 02:20)</a>:</h4>
<p>ok I think I added all the remaining ones <span class="user-mention" data-user-id="116009">@nikomatsakis</span> — I'm unsure about a few of them (some are confusing, especially without the warning, and I'm not 100% knowledgeable about the new checks the PR does) but I'll re-check those next week with your <code>try</code> build artifacts, and update the doc while you're in ICE-land <span aria-label="snowman" class="emoji emoji-2603" role="img" title="snowman">:snowman:</span> before you get back; in the meantime, enjoy your vacation <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span> :)</p>



<a name="181817671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/181817671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#181817671">(Nov 25 2019 at 12:33)</a>:</h4>
<p>(re-checked the ones I was unsure about, the hackmd should be ready for further analysis now)</p>



<a name="182643973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/182643973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#182643973">(Dec 05 2019 at 10:01)</a>:</h4>
<blockquote>
<p>(ah it seems like we mostly get the <code>warning: impl_potentially_overlapping_dyn_trait</code> when building a crate's own code, not always when it's in a dependency)</p>
</blockquote>
<p>interesting</p>



<a name="182644702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/182644702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#182644702">(Dec 05 2019 at 10:12)</a>:</h4>
<p>it's likely that "not always" == "never" in this case (for example the euphrades traits were not defined within the crate as these were the euphrates-cli logs)</p>



<a name="182681980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/182681980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#182681980">(Dec 05 2019 at 17:23)</a>:</h4>
<p>goes without saying, let me know if there's something I can do to help here :)</p>



<a name="182805233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/182805233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#182805233">(Dec 06 2019 at 21:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> thanks so much for going through that file, that's already super helpful</p>



<a name="182805266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/182805266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#182805266">(Dec 06 2019 at 21:11)</a>:</h4>
<p>you're very welcome</p>



<a name="185833502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/185833502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#185833502">(Jan 16 2020 at 16:44)</a>:</h4>
<p>I forgot to say earlier: I have triaged the crater results for the latest run but haven't had the time to post the results on the PR</p>



<a name="185833524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/185833524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#185833524">(Jan 16 2020 at 16:45)</a>:</h4>
<p>I hope no one was doing it at the same time</p>



<a name="185833544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/185833544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#185833544">(Jan 16 2020 at 16:45)</a>:</h4>
<p>I'll post the results shortly</p>



<a name="185840921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/185840921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#185840921">(Jan 16 2020 at 17:55)</a>:</h4>
<p>ok done <a href="https://github.com/rust-lang/rust/pull/66037#issuecomment-575269554" target="_blank" title="https://github.com/rust-lang/rust/pull/66037#issuecomment-575269554">https://github.com/rust-lang/rust/pull/66037#issuecomment-575269554</a> although there was one (<code>structural</code>) I wasn't able to find easily in the time I had, it's hidden in tests of a proc-macro derive. let me know if you need it <span class="user-mention" data-user-id="116009">@nikomatsakis</span> and I'll extract the repro a different way</p>



<a name="185929529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/coherence%20bypasses%20for%20traits%20%2357893/near/185929529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/coherence.20bypasses.20for.20traits.20.2357893.html#185929529">(Jan 17 2020 at 16:07)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> that was awesome, thanks</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>